"""
celery configs
http://docs.celeryproject.org/en/latest/userguide/configuration.html#general-settings
"""
from kombu import Queue

# backend
# CELERY_RESULT_BACKEND = RabbitMqConst.RABBITMQ_BROKER_URL

# 时区
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_ENABLE_UTC = True

# task_serializer = 'json'
# result_serializer = 'json'
# accept_content = ['json']


CELERYD_LOG_FORMAT = '%(message)s'

CELERYD_TASK_LOG_FORMAT = '%(message)s'

# 指定导入的任务模块
CELERY_IMPORTS = (
    'daemon.task',
)

# 指定celery队列
CELERY_QUEUES = (
    Queue('flask-template', routing_key='flask_template.task.#'),
)

CELERY_DEFAULT_EXCHANGE = 'flask_template.daemon.task'

# 交换机的类型
CELERY_DEFAULT_EXCHANGE_TYPE = 'topic'

# 默认交换价的key
CELERY_DEFAULT_ROUTING_KEY = 'flask_template.daemon.key'

# celery 消息调度设置
CELERY_ROUTES = {
    'daemon.task.ding_alarm': {
        'queue': 'flask-template',
        'routing_key': 'flask_template.task.ding-alarm',
    },
}
